import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';

import 'flutter_device_info_plugin_platform_interface.dart';

/// An implementation of [FlutterDeviceInfoPluginPlatform] that uses method channels.
class MethodChannelFlutterDeviceInfoPlugin extends FlutterDeviceInfoPluginPlatform {
  /// The method channel used to interact with the native platform.
  @visibleForTesting
  final methodChannel = const MethodChannel('flutter_device_info_plugin');

  @override
  Future<String?> getIDFA() async {
    final idfa = await methodChannel.invokeMethod<String>('getIDFA');
    return idfa;
  }

  @override
  Future<String?> getIDFV() async {
    final idfv = await methodChannel.invokeMethod<String>('getIDFV');
    return idfv;
  }

  @override
  Future<String?> getAppVersion() async {
    final version = await methodChannel.invokeMethod<String>('getAppVersion');
    return version;
  }

  @override
  Future<String?> getSystemVersion() async {
    final version = await methodChannel.invokeMethod<String>('getSystemVersion');
    return version;
  }

  @override
  Future<String?> getSystemName() async {
    final name = await methodChannel.invokeMethod<String>('getSystemName');
    return name;
  }

  @override
  Future<String?> originalDeviceInfo() async {
    final deviceInfo = await methodChannel.invokeMethod<String>('getOriginalDeviceInfo');
    return deviceInfo;
  }

  @override
  Future<String?> deviceNameplate() async {
    final deviceNameplate = await methodChannel.invokeMethod<String>('getDeviceNameplate');
    return deviceNameplate;
  }

  @override
  Future<String?> getLocalTimeZone() async {
    final timeZone = await methodChannel.invokeMethod<String>('getLocalTimeZone');
    return timeZone;
  }

  @override
  Future<String?> getLocalLanguageCode() async {
    final languageCode = await methodChannel.invokeMethod<String>('getLocalLanguageCode');
    return languageCode;
  }

  @override
  Future<Map<dynamic,dynamic>?> getWifiInfo() async {
    final Map<dynamic, dynamic> wifiInfo = await methodChannel.invokeMethod('getWifiInfo');
    return wifiInfo;
  }

  @override
  Future<bool?> isSimulator() async {
    final isSimulator = await methodChannel.invokeMethod<bool>('isSimulator');
    return isSimulator;
  }

  @override
  Future<bool?> isPhoneJailbreak() async {
    final isPhoneJailbreak = await methodChannel.invokeMethod<bool>('isPhoneJailbreak');
    return isPhoneJailbreak;
  }

  @override
  Future<String?> getTotalDiskSize() async {
    final totalDisk = await methodChannel.invokeMethod<String>('getTotalDiskSize');
    return totalDisk;
  }

  @override
  Future<String?> getTotalMemorySize() async {
    final totalMemory = await methodChannel.invokeMethod<String>('getTotalMemorySize');
    return totalMemory;
  }

  @override
  Future<String?> getAvailableDiskSize() async {
    final availableDisk = await methodChannel.invokeMethod<String>('getAvailableDiskSize');
    return availableDisk;
  }

  @override
  Future<String?> getAvailableMemorySize() async {
    final availableMemory = await methodChannel.invokeMethod<String>('getAvailableMemorySize');
    return availableMemory;
  }

  @override
  Future<String?> getNetReachableType() async {
    final reachableType = await methodChannel.invokeMethod<String>('getNetReachableType');
    return reachableType;
  }

  @override
  reportFaceBook(String? urlScheme, String? appId, String? displayName, String? clientToken) {
     var dic = {
       "urlScheme" : urlScheme ?? "",
       "appId" : appId ?? "",
       "disPlayName" : displayName ?? "",
       "clientToken" : clientToken ?? ""
     };
     methodChannel.invokeMethod('reportFaceBook',dic);
  }

  @override
  showDeniedAccessAlert(String? message) {
    methodChannel.invokeMethod('showDeniedAccessAlert',message);
  }

  @override
  Future<dynamic> openContact() async {
    final value = await methodChannel.invokeMethod<dynamic>('openContact');
    return value;
  }

  @override
  Future getContactInfo() async {
    final value = await methodChannel.invokeMethod<dynamic>('getContactInfo');
    return value;
  }

  @override
  Future<dynamic> startLocation() async {
    final value = await methodChannel.invokeMethod<dynamic>('startLocation');
    return value;
  }

  @override
  showSKStoreReview() {
    methodChannel.invokeMethod('showSKStoreReview');
  }

}
